package com.nfit.shopweb.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.nfit.shopmodel.entity.product.ProductSpec;
import com.nfit.shopweb.mapper.ProductSpecMapper;
import com.nfit.shopweb.service.ProductSpecService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * ClassName:ProductSpecServiceImpl
 * Package:com.nfit.shopweb.service.impl
 * Description
 *
 * @Author L
 * @Create 2024/12/16 15:01
 */
@Service
public class ProductSpecServiceImpl implements ProductSpecService {

    @Autowired
    private ProductSpecMapper productSpecMapper;


    @Override
    public PageInfo<List<ProductSpec>> page(Integer pageNum,Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<ProductSpec> list = productSpecMapper.page();
        PageInfo pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public void save(ProductSpec productSpec) {
        productSpecMapper.save(productSpec);
    }

    @Override
    public void delete(Long id) {
        productSpecMapper.delete(id);
    }

    @Override
    public void update(ProductSpec productSpec) {
        productSpecMapper.update(productSpec);
    }

    /**
     * 查询所有商品规格
     */
    @Override
    public List<ProductSpec> list() {
        return productSpecMapper.list();
    }
}
